package com.intelligent.health.quartz.job;

import lombok.extern.slf4j.Slf4j;
import org.quartz.*;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: torlesse-liang
 * @Date: 2022/04/08/0:58
 * @Description:
 */
@Slf4j
public class HealthJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            executeTask(jobExecutionContext);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static void executeTask(JobExecutionContext jobExecutionContext) throws SchedulerException {
        //JobExecutionContext 类提供了调度应用的一些信息；
        //Job 运行时的信息保存在 JobDataMap 实例中。
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        System.out.println(new Date() + "->" + key.toString() + "定时任务正在执行");
    }

}
